import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          "文本及样式",
          style: TextStyle(
            color: Colors.blue,
            fontSize: 40,
            fontWeight: FontWeight.bold,
          ),
        ),
        centerTitle: true,
      ),
      body: Center(
        child: Column(
          children: <Widget>[
            ElevatedButton(
              onPressed: () {
                print("点击了按钮");
              },
              child: Text("normal"),
              style: ButtonStyle(
                backgroundColor: MaterialStateProperty.all(Colors.blue),
                foregroundColor: MaterialStateProperty.all(Colors.white),
                overlayColor: MaterialStateProperty.all(Colors.red),
                shadowColor: MaterialStateProperty.all(Colors.green),
                elevation: MaterialStateProperty.all(10),
                padding: MaterialStateProperty.all(EdgeInsets.all(20)),
                textStyle: MaterialStateProperty.all(TextStyle(fontSize: 20)),
              ),
            ),
            TextButton(
              onPressed: () {
                print("点击了文本按钮");
              },
              child: Text(
                "Submit",
                style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
              ),
              style: TextButton.styleFrom(
                backgroundColor: Colors.red,
                foregroundColor: Colors.white,
                shadowColor: Colors.green,
                elevation: 10,
                padding: EdgeInsets.all(20),
                textStyle: TextStyle(fontSize: 20),
              ),
            ),
            OutlinedButton(
              onPressed: () {
                print("点击了轮廓按钮");
              },
              child: Text("轮廓按钮"),
            ),
            IconButton(
              onPressed: () {
                print("点击了图标按钮");
              },
              icon: Icon(Icons.thumb_up, size: 40, color: Colors.blue),
            ),
            // 带图标的按钮
            ElevatedButton.icon(
              onPressed: () {},
              label: Text("发送"),
              icon: Icon(Icons.send, size: 30),
            ),
            TextButton.icon(
              onPressed: () {},
              label: Text("添加"),
              icon: Icon(Icons.add, size: 50, color: Colors.red,),
            ),
            OutlinedButton.icon(
              onPressed: () {},
              label: Text("详情"),
              icon: Icon(Icons.info, size: 50, color: Colors.grey,),
            ),
          ],
        ),
      ),
    );
  }
}
